package cn.rengy.web.framework.sys.area;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.rengy.tool.core.util._LongUtil;
import cn.rengy.web.framework.sql.DbService;

@Service
public class AreaService {
	@Autowired
	private DbService dbService;
	
	public void reSetTreeid() {
		List<Map<String,Object>> list=this.dbService.queryForList("select_all_area");
		for(Map<String,Object> a:list) {
			Integer adcode=(Integer)a.get("adcode");
			String tree_id=(String)a.get("tree_id");
			String arr[]=tree_id.split("-");
			StringBuilder new_tree_id=new StringBuilder();
			for(String ar:arr) {
				String t=_LongUtil.toString(Long.parseLong(ar));
				new_tree_id.append(t).append("-");
			}
			new_tree_id.deleteCharAt(new_tree_id.length()-1);
			this.dbService.update("update_area_tree_id", new_tree_id,adcode);
		}
	}
}
